package com.lykj.lib_base.internal.utils

import com.blankj.utilcode.util.SPUtils
import com.lykj.lib_base.app.BaseApplication

object CookieUtils {
    var mToken = ""
    var mAgentToken = ""

    fun saveToken(token: String) {
        this.mToken = token
        SPUtils.getInstance().put("cookie", token, true)
    }

    fun saveAgentToken(token: String) {
        this.mAgentToken = token
        SPUtils.getInstance().put("agent_cookie", token, true)
    }

    fun getCookieToken(): String {
        if (mToken.isNullOrBlank()) {
            mToken = SPUtils.getInstance().getString("cookie", "")
        }
        return mToken
    }

    fun getAgentCookieToken(): String {
        if (mAgentToken.isNullOrBlank()) {
            mAgentToken = SPUtils.getInstance().getString("agent_cookie", "")
        }
        return mAgentToken
    }
}